#ifndef INCLUDE_MM_H_
#define INCLUDE_MM_H_
#include "type.h"
#include "sched.h"


//31                12| 11  9  8   7   6
//
//Page Frame Number   |   C  | D | V | G |ASID
typedef struct PTE
{
    uint64_t Hi;
    uint64_t Lo0;
    uint64_t Lo1;
    int mapping;
    int in_tlb;
} PTE_t; /* 128 + 28 = 156B */

PTE_t task1_table[128]; //2^20 PTE

typedef struct pageframe
{
    uint32_t paddr;
    struct pageframe *pre;
    struct pageframe *next;
} pageframe_t;

pageframe_t mem_used[128];//2^18 pfn

void init_page_table();
void init_page_table_task3();
void do_TLB_Refill();
void do_TLB_Invalid();

void do_page_fault();
void init_TLB(void);
void physical_frame_initial(void);

#endif
